﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using ZLDC.Common.BaseUser;


namespace ZLDC.Common
{
    public class C_ExcuteReader
    {
        public C_ExcuteReader()
        {
        }

        public static bool ExecuteReader(string sql)
        {
            SqlDataReader dr;
            DataBase db = new DataBase();

            dr = db.SelectRecord(sql);
            if (dr.Read())
            {
                db.ConnectClose();
                return true;
            }
            else
            {
                db.ConnectClose();
                return false;
            }
        }

        public static bool ExcelDBsql(string sql)
        {
            DataBase db = new DataBase();
            if (db.ExecSql(sql) == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        public static bool ExecuteReaderAll(string sql, string dsn)
        {
            SqlDataReader dr;
            DataBaseAll db = new DataBaseAll(dsn);

            dr = db.SelectRecord(sql);
            if (dr.Read())
            {
                db.ConnectClose();
                return true;
            }
            else
            {
                db.ConnectClose();
                return false;
            }
        }

        public static bool ExcelDBsqlAll(string sql, string dsn)
        {
            DataBaseAll db = new DataBaseAll(dsn);
            if (db.ExecSql(sql) == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
